#pragma once
#include "wc3main.h"
#include "wc3refcnt.h"
#include "wc3observer.h"
#include "wc3nettag.h"

procedure wc3agent_Init();
void wc3agent_main();

	class TAgent : public TObserver
	{
		TNetTag kContainer;
		TObserver AgentObserver;
	public:
		Dword GetTypeId();
		Boolean IsValid();
		procedure Destroy();
	};

	typedef TAgent* PAgent;
	
	class TAgentWar3 : public TAgent
	{
	public:
		Dword AgentWar3Flags;
	};

	typedef TAgentWar3* PAgentWar3;

	class TAgileData {};
	
	typedef TAgileData* PAgileData;

	typedef Boolean (*TEnumAgentCallback)(PAgent Instanc, Pointer Param);

    class TPresenceRef_VMT : public TRefCnt_VMT
	{
		typedef procedure (__stdcall *pClear) ();
	public:
		pClear Clear;
	};

	class TPresenceRef : public TRefCnt
	{
	public:
		TNetTag NetTag;
	};

	typedef TPresenceRef* PPresenceRef;

	class TAgentField_VMT : public TPresenceRef_VMT
	{
		typedef procedure (__stdcall *CopyTag_1) (Integer Index, Pointer Container);
		typedef Pointer (__stdcall *GetParentContainer_1) ();
		typedef PAgent (__stdcall *GetParentContainerValue_1) ();
	public:
		CopyTag_1 CopyTag_;
		GetParentContainer_1 GetParentContainer_;
		GetParentContainerValue_1 GetParentContainerValue_;
	};
	
	typedef TPresenceRef TAgentField;
	typedef PPresenceRef PAgentField;
	
	typedef TAgentField TInteger;
	typedef TInteger* PInteger;
	
	typedef TAgentField TFloat;
	typedef TFloat* PTFloat;

	procedure EnumTypeInstances (Dword TypeId, TEnumAgentCallback Callback, const Pointer Param, const LongBool EnumChilds);
	//procedure EnumTypeInstances(TypeId: Dword; Callback: TEnumAgentCallback; Param: Pointer = NULL; EnumChilds: LongBool = false);
	
	//PAgileData* ppAgileData;

	struct TEnumAgentParam
	{
		TEnumAgentCallback Callback;
		Pointer Param;
	};

	typedef TEnumAgentParam* PEnumAgentParam;